package cn.bearspark.happening.provider.component;

import cn.bearspark.idgenerator.enumeration.IdCodeEnum;
import cn.bearspark.idgenerator.rpc.IdGeneratorRpc;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Component;

/**
 * 动态模块中生成 id 的组件
 *
 * @author f
 */
@Component
public class IdGeneratorComponent {

    @DubboReference
    private IdGeneratorRpc idGeneratorRpc;

    /**
     * 生成 id
     *
     * @return 生成的 id
     */
    public Long generateId() {
        return idGeneratorRpc.generateId(IdCodeEnum.HAPPENING_ID);
    }

}
